//2009/08/18 23:04:29
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class BasketsWithApples
{
public:
    int removeExcess(vector <int> apples)
    {
		int mmax = -1;
		sort(apples.rbegin(), apples.rend());
		for(int i=0; i<apples.size(); i++) cout << apples[i] << " ";
		for(int i=0; i<apples.size(); i++)
		{
			int sum = 0;
			for(int j=i+1; j<apples.size(); j++) sum += apples[j];
			mmax = max(mmax, apples[i]*(i+1));
		}
		return mmax;
    }
};
